import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '单方姓名',
    align: "center",
    dataIndex: 'name'
  },
  {
    title: '单方电话',
    align: "center",
    dataIndex: 'phone'
  },
  {
    title: '单方证件号',
    align: "center",
    dataIndex: 'idNum'
  },
  {
    title: '地区',
    align: "center",
    dataIndex: 'areaCode',
  },
  {
    title: '地区名称',
    align: "center",
    dataIndex: 'areaName'
  },
  {
    title: '详细地址',
    align: "center",
    dataIndex: 'detailAddr'
  },
  {
    title: '经纬度',
    align: "center",
    dataIndex: 'lnglat'
  },
  {
    title: '单方类型',
    align: "center",
    dataIndex: 'sidesType_dictText'
  },
  {
    title: '公司',
    align: "center",
    dataIndex: 'companyId_dictText'
  },
  {
    title: '状态',
    align: "center",
    dataIndex: 'status_dictText'
  },
  {
    title: '过期版本号',
    align: "center",
    dataIndex: 'version'
  },
];

//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "单方姓名",
    field: 'name',
    component: 'Input',
    //colProps: {span: 6},
  },
  {
    label: "单方电话",
    field: 'phone',
    component: 'Input',
    //colProps: {span: 6},
  },
  {
    label: "单方证件号",
    field: 'idNum',
    component: 'Input',
    //colProps: {span: 6},
  },
  {
    label: "地区",
    field: 'areaCode',
    component: 'JAreaLinkage',
    //colProps: {span: 6},
  },
  {
    label: "单方类型",
    field: 'sidesType',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "sides_type"
    },
    //colProps: {span: 6},
  },
  {
    label: "公司",
    field: 'companyId',
    component: 'JSearchSelect',
    componentProps:{
      dict: "wlhy_company where version = '9999-09-09 00:00:00' and status = 1,company_name,id"
    },
    //colProps: {span: 6},
  },
  {
    label: "状态",
    field: 'status',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "row_status"
    },
    //colProps: {span: 6},
  },
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '单方姓名',
    field: 'name',
    component: 'Input',
  },
  {
    label: '单方电话',
    field: 'phone',
    component: 'Input',
  },
  {
    label: '单方证件号',
    field: 'idNum',
    component: 'Input',
  },
  {
    label: '地区',
    field: 'areaCode',
    component: 'JAreaLinkage',
  },
  {
    label: '地区名称',
    field: 'areaName',
    component: 'Input',
  },
  {
    label: '详细地址',
    field: 'detailAddr',
    component: 'Input',
  },
  {
    label: '经纬度',
    field: 'lnglat',
    component: 'Input',
  },
  {
    label: '单方类型',
    field: 'sidesType',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "sides_type"
    },
  },
  {
    label: '公司',
    field: 'companyId',
    component: 'JSearchSelect',
    componentProps:{
      dict: "wlhy_company where version = '9999-09-09 00:00:00' and status = 1,company_name,id"
    },
  },
  {
    label: '状态',
    field: 'status',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "row_status"
    },
  },
  {
    label: '过期版本号',
    field: 'version',
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      valueFormat: 'YYYY-MM-DD HH:mm:ss'
    },
  },
	// TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];

// 高级查询数据
export const superQuerySchema = {
  name: {title: '单方姓名',order: 0,view: 'text', type: 'string',},
  phone: {title: '单方电话',order: 1,view: 'text', type: 'string',},
  idNum: {title: '单方证件号',order: 2,view: 'text', type: 'string',},
  areaCode: {title: '地区',order: 3,view: 'pca', type: 'string',},
  areaName: {title: '地区名称',order: 4,view: 'text', type: 'string',},
  detailAddr: {title: '详细地址',order: 5,view: 'text', type: 'string',},
  lnglat: {title: '经纬度',order: 6,view: 'text', type: 'string',},
  sidesType: {title: '单方类型',order: 7,view: 'list', type: 'string',dictCode: 'sides_type',},
  companyId: {title: '公司',order: 8,view: 'sel_search', type: 'string',dictTable: "wlhy_company where version = '9999-09-09 00:00:00' and status = 1", dictCode: 'id', dictText: 'company_name',},
  status: {title: '状态',order: 9,view: 'list', type: 'string',dictCode: 'row_status',},
  version: {title: '过期版本号',order: 10,view: 'datetime', type: 'string',},
};
